var keyboard = {
    init: function(){
        document.addEventListener('keydown', function(e){
            switch(e.keyCode){
                case 37:
                    keyboard.left = true;
                    break;
                case 38:
                    keyboard.up = true;
                    break;
                case 39:
                    keyboard.right = true;
                    break;
                case 40:
                    keyboard.down = true;
                    break;
            }
            console.log(e.keyCode);
        });
        document.addEventListener('keyup', function(e){
            switch(e.keyCode){
                case 37:
                    keyboard.left = false;
                    break;
                case 38:
                    keyboard.up = false;
                    break;
                case 39:
                    keyboard.right = false;
                    break;
                case 40:
                    keyboard.down = false;
                    break;
            }
            console.log(e.keyCode);
        });
    },

    //keys
    up: false,
    down: false,
    left: false,
    right: false
};